<script>
//1、除reject外，还可通过throw返回失败promise对象
let p1 = new Promise((resolve, reject) => {
    // throw new Error("***")
    // throw 2  //可以抛出任何东西
    throw "str"

})
p1.then(value => {
    console.log('success', value)
},reason => {
    console.log('failure', reason)
    console.log("___________________________________")
})


//2、一个promise指定多个回调函数(成功/失败)，都会被调用
let p2 = new Promise((resolve, reject) => {
    resolve(1)
})
p2.then(value => {
    console.log('第一个', value)
})
p2.then(value => {
    console.log('第二个', value)
    console.log('___________________________________')
})



let p3 = new Promise((resolve, reject) => {
    reject(2)
})
p3.then(
        ()=>{},
        value => {console.log('第一个', value)}
    )
p3.then(
        ()=>{},
        value => {console.log('第二个', value)}
    )

</script>